package com.yuyue.springFramework.note05.annotation;

import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * 定义工厂类
 */
@Component
public class FactoryComponent {
    //定义bean
    @Bean(name = "fComponent")
    public ComponentEntity createComponent(){
        return new ComponentEntity();
    }

    //定义bean,并调用别的bean生成方法
    @Bean(name = "fComponent1")
    public ComponentEntity1 createComponent1(){
        ComponentEntity1 componentEntity1 = new ComponentEntity1();
        componentEntity1.setComponentEntity(createComponent());
        return componentEntity1;
    }
}
